<?php

use think\facade\Route;

//miss路由，定义404
Route::miss(function () {
    @header("http/1.1 404 not found");
    @header("status: 404 not found");
    exit();
});

//首页
Route::group('index', function () {
    Route::get('/index', 'index/index');
    Route::get('/communal', 'index/communal');
});

//新闻
Route::group('news', function () {
    Route::get('/index', 'news/index');
    Route::get('/info', 'news/info');
    Route::get('/getList', 'news/getList');
});

//授权登录
Route::group('login', function () {
    Route::post('/miniAppletLogin', 'login/miniAppletLogin');
});

//支付回调
Route::group('callback', function () {
    Route::rule('/weChatOrder', 'callback/weChatOrder');
    Route::rule('/aliPayOrder', 'callback/aliPayOrder');
    Route::rule('/day', 'callback/day');
    Route::rule('/clearCart', 'callback/clearCart');
    Route::rule('/ossBackup', 'callback/ossBackup');
});


//商品
Route::group('product', function () {
    Route::get('/index', 'product/index');
    Route::get('/getHistory', 'product/getHistory')->middleware('verify');
    Route::get('/details', 'product/details');
    Route::get('/seckill_details', 'product/seckill_details');
    Route::get('/getProductCate', 'product/getProductCate');
    Route::get('/getSeckill', 'product/getSeckill');
    Route::get('/getProductSpec', 'product/getProductSpec');
    Route::get('/order_detail', 'product/order_detail');

    Route::get('/getList', 'product/getList');
    Route::post('/submit', 'product/submit')->middleware('verify');
    Route::get('/getShare', 'product/getShare')->middleware('verify');
    Route::post('/emptySearch', 'product/emptySearch')->middleware('verify');
});
/**
 * 积分商城
 */
Route::group('lntegral', function () {
    Route::get('/index', 'lntegral/index');
    Route::get('/getList', 'lntegral/getList');
    Route::get('/details', 'lntegral/details');
    Route::get('/getProductSpec', 'lntegral/getProductSpec');
    Route::get('/orderInfo', 'lntegral/orderInfo')->middleware('verify');
    Route::post('/submit', 'lntegral/submit')->middleware('verify');
    Route::post('/orderSubmit', 'lntegral/orderSubmit')->middleware('verify');
    Route::get('/payment', 'lntegral/payment')->middleware('verify');
    Route::get('/getLntegralLog', 'lntegral/getLntegralLog')->middleware('verify');
    Route::post('/confirmPayment', 'lntegral/confirmPayment')->middleware('verify');
});

//优惠券
Route::group('coupon', function () {
    Route::get('/getList', 'coupon/getList');
    Route::get('/getMyList', 'coupon/getMyList');
    Route::get('/mygetList', 'coupon/mygetList');
    
    Route::get('/myMoupon', 'coupon/myMoupon');
    Route::post('/couponAdd', 'coupon/couponAdd');
    Route::post('/couponAllAdd', 'coupon/couponAllAdd');
})->middleware('verify');

//购物车
Route::group('cart', function () {
    Route::get('/index', 'cart/index')->middleware('verify');
    Route::get('/getCartCount', 'cart/getCartCount')->middleware('verify');
    Route::get('/getCartNum', 'cart/getCartNum');
    Route::post('/add', 'cart/add')->middleware('verify');
    Route::post('/cartSaveNum', 'cart/cartSaveNum')->middleware('verify');
    Route::post('/emptyCart', 'cart/emptyCart')->middleware('verify');
    Route::post('/edit', 'cart/edit')->middleware('verify');
    Route::post('/submit', 'cart/submit')->middleware('verify');
});

//订单相关
Route::group('order', function () {
    Route::get('/index', 'order/index');
    Route::get('/payment', 'order/payment');
    Route::get('/my_order', 'order/my_order');
    Route::get('/getOrderProduct', 'order/getOrderProduct');
    Route::get('/getTeamOrderList', 'order/getTeamOrderList');
    Route::get('/getRefundList', 'order/getRefundList');
    Route::get('/getLogistics', 'order/getLogistics');
    Route::get('/refund_detail', 'order/refund_detail');

    Route::get('/my_order_details', 'order/my_order_details');
    Route::get('/getList', 'order/getList');
    Route::get('/order_form', 'order/order_form');

    Route::post('/order_refund', 'order/order_refund');
    Route::post('/submit', 'order/submit');
    Route::post('/confirmPayment', 'order/confirmPayment');
    Route::post('/payAgent', 'order/payAgent');
    Route::post('/uploadLogistics', 'order/uploadLogistics');

    Route::post('/edit', 'order/edit');
    Route::post('/addEvaluatet', 'order/addEvaluatet');
    Route::get('/getEvaluateList', 'order/getEvaluateList');

})->middleware('verify');
//收藏

Route::group('collect', function () {
    Route::get('/getList', 'collect/getList');
    Route::post('/addCollect', 'collect/addCollect');
    Route::post('/delCollect', 'collect/delCollect');
})->middleware('verify');
//个人中心
Route::group('user', function () {
    Route::get('/index', 'user/index');
    Route::get('/getUserInfo', 'user/getUserInfo');
    Route::get('/getFootPrint', 'user/getFootPrint');
    Route::get('/getClientFootPrint', 'user/getClientFootPrint');
    Route::get('/getUserQrcode', 'user/getUserQrcode');
    Route::get('/getMyAccount', 'user/getMyAccount');

    Route::get('/my_team', 'user/my_team');
    Route::get('/setting', 'user/setting');
    Route::get('/notify/:type', 'user/notify');
    Route::get('/method_index', 'user/method_index');
    Route::get('/method_info', 'user/method_info');
    Route::post('/method_save', 'user/method_save');
    Route::post('/edit', 'user/edit');
    Route::post('/savePhoto', 'user/savePhoto');
    Route::post('/saveNickname', 'user/saveNickname');
    Route::post('/logout', 'user/logout');
})->middleware('verify');

//资产 - 我的账户
Route::group('account', function () {
    Route::get('/index', 'account/index');
    Route::get('/record/:type', 'account/record');
    Route::get('/getList', 'account/getList');
})->middleware('verify');

//充值相关
Route::group('remit', function () {
    Route::get('/index', 'remit/index');
    Route::get('/record', 'remit/record');
    Route::get('/getList', 'remit/getList');
    Route::post('/save', 'remit/save');
})->middleware('verify');

//提现相关
Route::group('draw', function () {
    Route::get('/index', 'draw/index');
    Route::get('/record', 'draw/record');
    Route::get('/getList', 'draw/getList');
    Route::post('/save', 'draw/save');
})->middleware('verify');


//意见反馈
Route::group('message', function () {
    Route::get('/index', 'message/index');
    Route::post('/save', 'message/save');
})->middleware('verify');

//安全中心
Route::group('security', function () {
    Route::get('/index', 'security/index');
    Route::post('/save', 'security/save');
})->middleware('verify');

//地址相关
Route::group('address', function () {
    Route::get('/index', 'address/index');
    Route::get('/add', 'address/add');
    Route::get('/edit', 'address/edit');
    Route::get('/getArea', 'address/getArea');
    Route::post('/save', 'address/save');
    Route::post('/chooseDefault', 'address/chooseDefault');
    Route::post('/delete', 'address/delete');
    Route::post('/choice', 'address/choice');
})->middleware('verify');

//上传
Route::group('uploads', function () {
    Route::rule('/uploadImage', 'uploads/uploadImage');
});

//申请分销商
Route::group('makePlace', function () {
    Route::get('/index', 'makePlace/index');
    Route::post('/save', 'makePlace/save');
})->middleware('verify');
